package com.linQing.waterWork.config;

import com.linQing.waterWork.service.mongodb.ReportService;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * 定时器配置
 * @author dream
 * @date 2024-05-02 10:00:00
 */
@Configuration
@EnableScheduling
public class SchedulingConfig {

    @Resource
    private ReportService reportService;// 您的服务类，包含 updateDataDaily 方法

    @Scheduled(cron = "*/30 * * * * ?") // 每十分钟一执行，cron表达式根据需要调整
    public void scheduleUpdateDataDaily() {
        reportService.updateDataDaily();
    }
}